
<template>
  <div class="sendmsg-dialog">
    <el-dialog
      v-el-drag-dialog
      :visible.sync="sendMsgDialog.dialogSendMsgModal"
      :append-to-body="true"
      :title="sendMsgDialog.title"
      :width="sendMsgDialog.width">
      <el-tree
        :ref="refId"
        :props="sendMsgDialog.defaultProps"
        :data="sendMsgDialog.sendUsrList"
        node-key="id"
        show-checkbox/>

      <br>
      <el-form ref="formSendMsg" :rules="sendMsgDialog.rulesSendMsg" :model="sendMsgDialog.formSendMsg" label-width="40px">
        <el-form-item label="内容" prop="fcontent">
          <el-input v-model="sendMsgDialog.formSendMsg.fcontent" :autosize="{ minRows: 5 }" type="textarea" />
        </el-form-item>
        <el-form-item>
          <el-button :loading="sendMsgDialog.loadingFormSendMsg" type="primary" @click="confirmSendMsg">确认</el-button>
          <el-button @click="sendMsgDialog.dialogSendMsgModal = false">取消</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
  </div>
</template>
<script>
export default {
  name: 'SendMsgs',
  props: {
    sendMsgInfo: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      refId: 'selectTree',
      sendMsgDialog: this.sendMsgInfo
    }
  },
  mounted() {
    // console.log(this.sendMsgDialog, ' this.sendMsgDialog')
  },
  beforeDestroy() {

  },
  methods: {
    confirmSendMsg() {
      const selectMsgArr = this.$refs[this.refId].getCheckedKeys(true)
      // console.log(selectMsgArr, ' selectMsgArr')
      this.$emit('confirmSendMsg', selectMsgArr)
    }
  }
}
</script>
